import request from '@/config/axios'

// 分类 VO
export interface ClassifyVO {
  id: number // 主键
  name: string // 分类名称
  parentId: number // 父id
  sort: number // 显示顺序
}

// 分类 API
export const ClassifyApi = {
  // 查询分类列表
  getClassifyList: async () => {
    return await request.get({ url: `/system/classify/list` })
  },

  // 查询分类详情
  getClassify: async (id: number) => {
    return await request.get({ url: `/system/classify/get?id=` + id })
  },

  // 新增分类
  createClassify: async (data: ClassifyVO) => {
    return await request.post({ url: `/system/classify/create`, data })
  },

  // 修改分类
  updateClassify: async (data: ClassifyVO) => {
    return await request.put({ url: `/system/classify/update`, data })
  },

  // 删除分类
  deleteClassify: async (id: number) => {
    return await request.delete({ url: `/system/classify/delete?id=` + id })
  },

  // 导出分类 Excel
  exportClassify: async (params) => {
    return await request.download({ url: `/system/classify/export-excel`, params })
  }
}
